Questions tagged [import]
The import tag has no usage guidance.
37 questions
0
votes
1
answer
149
views
Best practice when declaring imports with different execution contexts in python?
Say I have a Python project that looks like this:
project/
├── package/
│ ├── __init__.py
│ ├── module1.py
└── main.py
I would like package/ to be self-contained, though it is called from main.py....
-1
votes
2
answers
112
views
Should uniqueness validation be on the database level or backend codebase level in data import
There is a kinda ETL task of importing data from csv to the database in project with legacy codebase and legacy database**. Data should be validated before persisting to database.
Validation includes ...
0
votes
1
answer
167
views
Is it bad practice to export all the names from one module both as named exports and as a default export?
I like to export the names in my modules both as individual named exports and grouped together in a default export. Like this:
// mod.js
export function f() {}
export const x = true
export default {f,...
0
votes
1
answer
514
views
What's the best way to import a python module in a python module without cluttering the modules namepace? [closed]
Let's say I am writing a python module module.py. Which provides functionalities for other parts of my code. Of course, the module has to import other modules. A simple example:
import abc as _abc
...
0
votes
5
answers
633
views
Why don't languages auto import everything?
Why is there a such thing as import in programming languages? If a package does not exist, then trying to import it would cause an error anyway. So why don't languages just auto import ALL available ...
0
votes
1
answer
818
views
How to use lazy import to speed up a list of known types in python? [closed]
I have an application in which the user can describe an analysis job via a yaml like
analysis:
learner:
name: LinearRegression
args:
solver: liblinear
and then it is parsed to ...
0
votes
1
answer
86
views
Better design for a REST import into web store
I have an import that needs to grab data from a REST service and import into an web store. It's basically an ETL type of service, but because the REST service can be slow and I don't want to call it ...
0
votes
2
answers
107
views
Transferring data from 1 web app into another offline
I have a web app that will be used locally on 2 different site. The program is a Vue web app made with node.js and express, using MySQL database. Due to limitation (no internet in site 1), there is no ...
1
vote
1
answer
450
views
Python Unit Tests Mocking Imports - Removing Dependencies for CI/CD
I have a project written in python that I would like to create unit tests on.
This project has a dependency on a database project which is a sort of abstraction layer to data connections.
The issue ...
-1
votes
1
answer
2k
views
Python dynamically import modules
I am trying to find the best practice for importing modules dynamically. I have multiple files in a specific folder called providers which contain a class Updater and all of them have the same objects....
3
votes
1
answer
1k
views
Strictly only importing modules in subdirectories: is this a good rule?
I'm making my 1st official project. It's written in Python, is open-sources, and I'd like people to be able to freely and easily fork and modify the code. The project name is "shelf" and the ...
1
vote
1
answer
227
views
Component based architectures in JS / PHP: what indicators suggest that a UI element ought to be written as an importable component?
N.B. Several months after initially asking this question (and not coming up with any satisfactory answers) I am now learning to use HTML Custom Elements / WebComponents. It seems the same question ...
5
votes
1
answer
709
views
Are legacy C# DataTable/SqlDataAdapters exponentially faster than SqlConnection/SqlCommand and/or LINQ to SQL DataContext.ExecuteCommand calls? [closed]
I can't believe DataTable/SqlDataAdapter massively beat out System.Data.Linq.DataContext.ExecuteCommand and ExecuteNonQuery (tried with both Stored Procedures and command text) and just straight ...
1
vote
0
answers
48
views
How to develop an Import/Export Functionality for my node application
I have a configuration application in Nodejs. It has a Component with name and uuid. A Component can have many Schemas. A Schema has a uuid, name, componentId, json. A Schema can have many ...
-2
votes
1
answer
298
views
Store line numbers of CSV in the database
In our environment, we often have to import CSV files into a database, where each line represents a record. Though there is no actual business use case for storing the original line numbers inside the ...
7
votes
2
answers
2k
views
Why is it necessary to "import" a library first before usage?
My question regards the use of import statements.
In most programming languages I've come across (e.g. Python, Scala, Go), it is necessary to first import a library before you can use its functions.
...
7
votes
2
answers
3k
views
Why should imports be made at the beginning
Why is it considered good style to do all imports in a python application at the beginning, even if what is imported is used only once?
I have been programming only shorter pieces of software for a ...
6
votes
2
answers
7k
views
Is importing wildcards a bad idea?
If I do this
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
Then why don't I do this, it's more convenient
...
7
votes
3
answers
2k
views
System Design: Very Large CSV Imports Every Month
We have a webapp that will rely on large CSVs from external vendors every month. When I say large, we are looking at around 6gb so a few million rows. Probably, 2-5 CSVs. This webapp will also allow ...
2
votes
1
answer
261
views
Maintainable way for keeping objects in memory
I am trying to figure out the best way to keep objects in memory without having them scattered everywhere within the code.
For example: I have a PyQT menu system which interacts with objects. ...
1
vote
2
answers
2k
views
Best way to import a large module to use in different modules
I have a python module dataProcessor.py which initialises a large amount of data into memory (approximately 3GB) I want to use this module in different processes which are running simultaneously.
...
4
votes
5
answers
10k
views
Import large csv files
I've been tasked to query 2 large csv files which are roughly 1 GB in size each. The files contain related data, so file one may contain a list of order numbers, Order Dates, etc and the file may ...
1
vote
2
answers
218
views
How can I include common strings (regexes) in several projects written in different languages?
I have a simple Go library (~300 lines, mostly type declarations and nice methods and compatibility methods for gomobile etc., also pretty-printing scripts). The heart of the whole project are two ...
3
votes
1
answer
84
views
Interactive review of data in modal before inserting in db
I'm looking for a conceptual approach to a problem.
I'm building a web app that imports data from a source I don't control. The data quality is pretty high, but occasionally, the data does not make ...
1
vote
1
answer
4k
views
Should I automatically install needed modules?
I'm writing a program for my grandpa. Occasionally an update will require a new module that's not installed on his computer. I don't want to have to manually install new modules every time, but he's ...
0
votes
1
answer
147
views
Recurring database migration
I'm importing data from older website to new one using database migrations. I have created first as one of first steps of development phase of new site. Then I planned to create another one, that will ...
3
votes
0
answers
598
views
Optimal data structure for binary data/Java
I have several input formats mostly restricted to geotiff and some proprietary binary formats. I import them into my program and then need to export them into various other data formats (also binary) ...
1
vote
0
answers
86
views
Help design this data import program
I want to import some data from various locations and pump it into MongoDb and some cloud services.
The data starts off as JSON, I read that JSON, create some objects in mongo, go to the next level ...
0
votes
1
answer
88
views
Plugins and exporting an API between python scripts
I've got a python script, which should read a subdirectory and make all the scripts within it callable like this:
python mainscript.py subscript arguments
I've figured out most of the details but I'm ...
3
votes
3
answers
2k
views
Python - defining exit method before importing
This breaks nothing (in my experience), but lots of things "don't break anything" and are still wrong.
#! /usr/bin/env python
"""Short description of this module."""
def preferred_exit_method(*args):...
0
votes
1
answer
82
views
Is it okay to check in changes to import statement on opensource projects on a commit? [duplicate]
There are some guidelines out there (eg scala guidelines) and I'm wondering if it's okay to do some tidying up when committing other changes or if the commits should be more focused and to the point?
...
3
votes
1
answer
942
views
Using naming conventions to make `import *` safer in Python
Consider the following code:
a.py
import os
def print_rand():
print os.urandom()
And another module:
b.py
from a import *
In this code, I end up with an os variable getting imported from a. ...
8
votes
4
answers
4k
views
When to import names into the global namespace? (using x::y, from x import y etc.)
I've been programming in various languages for about 10 years now. And I still haven't figured out when it is a good idea to import something into the global namespace (using x::y in C++, from x ...
-1
votes
2
answers
395
views
Ideal "intermediate" file format to use for structured/styled text? [closed]
I have files that I want to make available in an variety of formats:
HTML
PDF
EPUB
Plain Text (maybe)
Most of the files will be sourced in doc, docx, or rtf format, so that needs to be considered.
...
41
votes
3
answers
5k
views
Experience of Python's “PEP-302 New Import Hooks” [closed]
I'm one of the developers of Ruby (CRuby). We are working on Ruby 2.0 release (planned to release 2012/Feb).
Python has "PEP302: New Import Hooks" (2003):
This PEP proposes to add a new set of ...
5
votes
2
answers
2k
views
Development Patterns for dealing with Data Import / Export
I have a ASP.NET web based application that allows the end user to export data to a flat file format. (essentially taking a point-in-time backup of their work)
At a later date they can re-upload (...
0
votes
2
answers
785
views
Script/tool to import series of snapshots, each being a new edition, into GIT, populating source tree? [closed]
I've developed code locally and taken a fairly regular snapshot whenever I reach a significant point in development, e.g. a working build.
So I have a long-ish list of about 40 folders, each folder ...